﻿using HandyControl.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Reconstruct_Desktop.Views
{
    /// <summary>
    /// EntranceRegionView.xaml 的交互逻辑
    /// </summary>
    public partial class EntranceRegionView : UserControl
    {
        public EntranceRegionView()
        {
            InitializeComponent();
        }
        private Prism.Services.Dialogs.IDialogService Dialog;
        private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            short val;
            if (!Int16.TryParse(e.Text, out val))
                e.Handled = true;
        }
        private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Space)
                e.Handled = true;
        }
        //序号
        private void DgSceneRecord_LoadingRow(object sender, DataGridRowEventArgs e)
        {

            if (Index.PageIndex == 1)
            {
                e.Row.Header = e.Row.GetIndex() + 1;
            }
            else
            {
                e.Row.Header = (e.Row.GetIndex() + 1) + (Index.PageIndex - 1) *  int.Parse( Combobox.Text);
            }

        }
        private void DgSceneRecord_LoadingRow2(object sender, DataGridRowEventArgs e)
        {


            e.Row.Header = e.Row.GetIndex() + 1;

            e.Row.Header = (e.Row.GetIndex() + 1) + (Index.PageIndex - 1) * int.Parse(Combobox.Text);


        }
        //分页
        private void Pagination_PageUpdated(object sender, FunctionEventArgs<int> e)
        {
            string b = e.Info.ToString();

          

        }
        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox comboBox = (ComboBox)sender;
            ComboBoxItem selectedItem = comboBox.SelectedItem as ComboBoxItem;
            if (selectedItem != null)
            {
                // 获取ComboBox选中项的值
                string selectedValue = selectedItem.Content.ToString();
                // TODO: 处理ComboBox选中项的值
            }
        }
    }
}
